Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 19.0.5.7
|
Leadtools.Dicom.Annotations.Core Namespace > DicomAnnotationsUtilities Class > ToAnnObject Method : ToAnnObject(DicomDataSet,List<IDicomAnnotationObject>) Method |
public List<AnnObject> ToAnnObject( DicomDataSet ds, List<IDicomAnnotationObject> dicomAnnotationObjectList )
'Declaration Public Overloads Function ToAnnObject( _ ByVal ds As DicomDataSet, _ ByVal dicomAnnotationObjectList As List(Of IDicomAnnotationObject) _ ) As List(Of AnnObject)
'Usage Dim instance As DicomAnnotationsUtilities Dim ds As DicomDataSet Dim dicomAnnotationObjectList As List(Of IDicomAnnotationObject) Dim value As List(Of AnnObject) value = instance.ToAnnObject(ds, dicomAnnotationObjectList)
public: List<AnnObject^>^ ToAnnObject( DicomDataSet^ ds, List<IDicomAnnotationObject^>^ dicomAnnotationObjectList )
This example does the following:
Imports Leadtools Imports Leadtools.Dicom Imports Leadtools.Dicom.Annotations.Core Imports Leadtools.Annotations.Core Private Function DicomAnnotationsUtilities_ToAnnObject2() As List(Of AnnObject) ' Set up the DicomAnnotationsUtilities converter Dim du As New DicomAnnotationsUtilities() du.ImageDpiX = 96.0 du.ImageDpiY = 96.0 du.DisplayWidth = 200 du.DisplayHeight = 200 du.LayerName = "Layer 0" du.CompoundGraphicInstanceId = 100 du.GraphicGroupId = 123 ' LineStyle -- user for both rulers Dim lineStyle As New DicomLineStyle() lineStyle = New DicomLineStyle() lineStyle.LineOptions = DicomAnnotationLineOptions.None lineStyle.Shadow.ShadowStyle = DicomAnnotationShadowStyleType.Off lineStyle.Shadow.ShadowOpacity = 0.0F lineStyle.Shadow.ShadowOffsetX = 0.0F lineStyle.Shadow.ShadowOffsetY = 0.0F lineStyle.Shadow.ShadowColorCieLabValue = New UShort(2) {1, 2, 3} lineStyle.PatternOnColorCieLabValue = New UShort(2) {24886, 53484, 50171} ' red lineStyle.PatternOffColorCieLabValue = New UShort(2) {0, 0, 0} lineStyle.LineThickness = 2.0F lineStyle.LineDashingStyle = DicomAnnotationDashStyleType.Solid lineStyle.LinePattern = &HFFFF lineStyle.PatternOnOpacity = 1.0F lineStyle.PatternOffOpacity = 0.0F ' Create a compound graphic -- ruler0 Dim ruler0 As New DicomCompoundGraphic() ruler0.LayerName = "Layer 0" ruler0.Units = DicomAnnotationUnitsRelativityType.Pixel ruler0.Type = DicomAnnotationCompoundGraphicType.Ruler Dim pts(1) As DicomAnnotationPoint pts(0) = New DicomAnnotationPoint(100, 100) pts(1) = New DicomAnnotationPoint(200, 200) ruler0.SetAnnotationPoints(pts, pts.Length) ruler0.CompoundGraphicInstanceId = du.IncrementCompoundGraphicInstanceId() ruler0.GraphicGroupId = du.GraphicGroupId ruler0.Options = DicomAnnotationOptions.CompoundGraphicInstanceId Or DicomAnnotationOptions.GraphicGroupId ruler0.LineStyle = lineStyle.Clone() ' Create a compound graphic -- ruler0 Dim ruler1 As New DicomCompoundGraphic() ruler1.LayerName = "Layer 0" ruler1.Units = DicomAnnotationUnitsRelativityType.Pixel ruler1.Type = DicomAnnotationCompoundGraphicType.Ruler pts = New DicomAnnotationPoint(1) {} pts(0) = New DicomAnnotationPoint(200, 200) pts(1) = New DicomAnnotationPoint(300, 100) ruler1.SetAnnotationPoints(pts, pts.Length) ruler1.CompoundGraphicInstanceId = du.IncrementCompoundGraphicInstanceId() ruler1.GraphicGroupId = du.GraphicGroupId ruler1.Options = DicomAnnotationOptions.CompoundGraphicInstanceId Or DicomAnnotationOptions.GraphicGroupId ruler1.LineStyle = lineStyle.Clone() ' Convert the DICOM Annotation to a LEAD annotation Dim listDicomObjects As New List(Of DicomAnnotationObject)() listDicomObjects.Add(ruler0) listDicomObjects.Add(ruler1) ' Create the DicomDataSet that has the GraphicGroupSequence Dim dsPre As New DicomDataSet() Dim graphicGroupSequenceElement As DicomElement = dsPre.InsertElement(Nothing, False, DicomTag.GraphicGroupSequence, DicomVRType.SQ, True, 0) Dim item As DicomElement = dsPre.InsertElement(graphicGroupSequenceElement, True, DicomTag.Item, DicomVRType.SQ, True, 0) dsPre.InsertElementAndSetValue(item, True, DicomTag.GraphicGroupLabel, "PolyRulerObject") dsPre.InsertElementAndSetValue(item, True, DicomTag.GraphicLayerDescription, "LEAD Annotation") dsPre.InsertElementAndSetValue(item, True, DicomTag.GraphicGroupID, du.GraphicGroupId) Dim annObjectList As List(Of AnnObject) = du.ToAnnObject(dsPre, listDicomObjects) Return annObjectList End Function
using Leadtools; using Leadtools.Dicom; using Leadtools.Dicom.Annotations.Core; using Leadtools.Annotations.Core; private List<AnnObject> DicomAnnotationsUtilities_ToAnnObject2() { // Set up the DicomAnnotationsUtilities converter DicomAnnotationsUtilities du = new DicomAnnotationsUtilities(); du.ImageDpiX = 96.0; du.ImageDpiY = 96.0; du.DisplayWidth = 200; du.DisplayHeight = 200; du.LayerName = "Layer 0"; du.CompoundGraphicInstanceId = 100; du.GraphicGroupId = 123; // LineStyle -- user for both rulers DicomLineStyle lineStyle = new DicomLineStyle(); lineStyle = new DicomLineStyle(); lineStyle.LineOptions = DicomAnnotationLineOptions.None; lineStyle.Shadow.ShadowStyle = DicomAnnotationShadowStyleType.Off; lineStyle.Shadow.ShadowOpacity = 0.0f; lineStyle.Shadow.ShadowOffsetX = 0.0f; lineStyle.Shadow.ShadowOffsetY = 0.0f; lineStyle.Shadow.ShadowColorCieLabValue = new ushort[3] { 1, 2, 3 }; lineStyle.PatternOnColorCieLabValue = new ushort[3] { 24886, 53484, 50171 }; // red lineStyle.PatternOffColorCieLabValue = new ushort[3] { 0, 0, 0 }; lineStyle.LineThickness = 2.0f; lineStyle.LineDashingStyle = DicomAnnotationDashStyleType.Solid; lineStyle.LinePattern = 0xFFFF; lineStyle.PatternOnOpacity = 1.0f; lineStyle.PatternOffOpacity = 0.0f; // Create a compound graphic -- ruler0 DicomCompoundGraphic ruler0 = new DicomCompoundGraphic(); ruler0.LayerName = "Layer 0"; ruler0.Units = DicomAnnotationUnitsRelativityType.Pixel; ruler0.Type = DicomAnnotationCompoundGraphicType.Ruler; DicomAnnotationPoint[] pts = new DicomAnnotationPoint[2]; pts[0] = new DicomAnnotationPoint(100, 100); pts[1] = new DicomAnnotationPoint(200, 200); ruler0.SetAnnotationPoints(pts, pts.Length); ruler0.CompoundGraphicInstanceId = du.IncrementCompoundGraphicInstanceId(); ruler0.GraphicGroupId = du.GraphicGroupId; ruler0.Options = DicomAnnotationOptions.CompoundGraphicInstanceId | DicomAnnotationOptions.GraphicGroupId; ruler0.LineStyle = lineStyle.Clone(); // Create a compound graphic -- ruler0 DicomCompoundGraphic ruler1 = new DicomCompoundGraphic(); ruler1.LayerName = "Layer 0"; ruler1.Units = DicomAnnotationUnitsRelativityType.Pixel; ruler1.Type = DicomAnnotationCompoundGraphicType.Ruler; pts = new DicomAnnotationPoint[2]; pts[0] = new DicomAnnotationPoint(200, 200); pts[1] = new DicomAnnotationPoint(300, 100); ruler1.SetAnnotationPoints(pts, pts.Length); ruler1.CompoundGraphicInstanceId = du.IncrementCompoundGraphicInstanceId(); ruler1.GraphicGroupId = du.GraphicGroupId; ruler1.Options = DicomAnnotationOptions.CompoundGraphicInstanceId | DicomAnnotationOptions.GraphicGroupId; ruler1.LineStyle = lineStyle.Clone(); // Convert the DICOM Annotation to a LEAD annotation List<DicomAnnotationObject> listDicomObjects = new List<DicomAnnotationObject>(); listDicomObjects.Add(ruler0); listDicomObjects.Add(ruler1); // Create the DicomDataSet that has the GraphicGroupSequence DicomDataSet dsPre = new DicomDataSet(); DicomElement graphicGroupSequenceElement = dsPre.InsertElement(null, false, DicomTag.GraphicGroupSequence, DicomVRType.SQ, true, 0); DicomElement item = dsPre.InsertElement(graphicGroupSequenceElement, true, DicomTag.Item, DicomVRType.SQ, true, 0); dsPre.InsertElementAndSetValue(item, true, DicomTag.GraphicGroupLabel, "PolyRulerObject"); dsPre.InsertElementAndSetValue(item, true, DicomTag.GraphicLayerDescription, "LEAD Annotation"); dsPre.InsertElementAndSetValue(item, true, DicomTag.GraphicGroupID, du.GraphicGroupId); List<AnnObject> annObjectList = du.ToAnnObject(dsPre, listDicomObjects); return annObjectList; }